#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

start_service() {
	local log_stderr
	local log_stdout
	local test_setting

	config_load node-red
	config_get port "common" port "1880"
	config_get_bool verbose "common" verbose "0"
	config_get_bool log_stderr "common" log_stderr "0"
	config_get_bool log_stdout "common" log_stdout "0"

	procd_open_instance
	procd_set_param env HOME=/root
	procd_set_param command /usr/bin/node-red
	procd_append_param command --port "$port"
	[ "$verbose" = "1" ] && procd_append_param command --verbose
	procd_set_param stdout "$log_stdout"
	procd_set_param stderr "$log_stderr"

	procd_close_instance
}
